package com.example.lancooznbk.view;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;


/**
 * Created by tangminglong on 17/10/18.
 */

public class Test {
    public static void main(String[] args) {
        String date1 = "2009-07-16T19:20:30.03";
        String pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS";
        DateFormat simpleDateFormat = new SimpleDateFormat(pattern, Locale.CHINA);
        Date parse = null;
        try {
            parse = simpleDateFormat.parse(date1);
        } catch (ParseException e) {
            e.printStackTrace();
            System.out.println("异常"); // 2009-07-16T19:20:30-05:00
        }

        DateFormat df = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss",Locale.CHINA);
        String format1 = df.format(parse);
        System.out.println(format1); // 2009-07-16T19:20:30-05:00
    }
}
